<%@page import="org.blog.messages.BlogMessage"%>
<%@page import="org.blog.logic.BlogLogic"%>
<%@page import="org.blog.beans.Blog"%>
<%@page import="java.util.ArrayList"%>
<%@page import="org.blog.messages.UserSettingsMessage"%>
<%@page import="org.blog.controller.UserController"%>
<%@page import="org.blog.beans.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1" %>
<%@ page errorPage="../jsp/exceptionHandler.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<jsp:include page="../jsp/cssChoose.jsp" />

<script type="text/javascript" src="js/validation.js"></script>

<title><%= request.getParameter("title") %></title>
</head>
<body>
 	<div id = "container"> 	
 	 	
 	<%Blog blog = (Blog)session.getAttribute("blog"); %> 	
 	 	
 	<jsp:include page="../jsp/header.jsp">
 		<jsp:param value="<%= blog.getName() %>" name="title"/>
 	</jsp:include>
 		<div id="texts">
	<jsp:include page="../jsp/menu.jsp"/>	
		
		<div id = "content">
		
			<h1><%= blog.getName() %></h1>	
			
			<% BlogMessage bm = (BlogMessage)request.getAttribute("message"); 
				   if(bm == null) bm = new BlogMessage();
			%>
			
			<%if(UserController.isLogged(session))
				if(blog.getUserId() == UserController.getUser(session).getId()) { %>
					
				<form name = "addEntry" method = "post" action = "EntryServlet">
								
					tytul: <br/>
					<input type="text" name = "title" ><br/>
					<div id = "titleE" class = "error">  <%= bm.getEntrytitle() %></div>
					
					tresc: <br/>
					<textarea rows="5" cols="30" name = "text" ></textarea> <br/>
					<div id = "textE" class = "error"> <%= bm.getEntryText() %></div>
					
					<button type = "submit">dodaj</button>
					
				</form>
					
				<%} %>
</div>
	</div>
		<jsp:include page="../html/footer.html"/>
						

	</div>
	
</body>
</html>